<%--
  Created by IntelliJ IDEA.
  User: 62585
  Date: 2021/3/29
  Time: 10:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ajax</title>
    <script type="text/javascript" src="script/jquery-1.7.2.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#ajaxGet").click(function () {
                $.get("http://localhost:8080/databinder/jsonTest", function (data) {
                    for (var i = 0; i < data.length; i++) {
                        var id = data[i].id;
                        var name = data[i].name;
                        var gender = data[i].gender;
                        // console.log("id : " + id + ", name : " + name + ", gender : " + gender);
                        $("#employees tbody").append("<tr><td>" + id + "</td><td>" + name + "</td><td>" + gender + "</td></tr>");
                    }
                }, "json")
            });
        })
    </script>
</head>
<body>
<div id="response"></div>
<button id="ajaxGet" name="ajaxGet">ajaxGet</button>
<table id="employees">
    <thead>
    <tr>
        <th>id</th>
        <th>name</th>
        <th>gender</th>
    </tr>
    </thead>
    <tbody>
    </tbody>
</table>

</body>
</html>
